import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex);

const store = new Vuex.Store({
  state:{
    type: false,
    countdown:{
      time: 180,
      count: 10000
    },
    statistics: {
      count: 0,
      score: 0
    },
    errorList: []
  },
  mutations: {
    COUNTDOWN( state, payload ){
      state.countdown.time = payload - 1     
    },
    RESET( state, payload ){
      state.countdown = {
        time: 8,
        count: 10000
      },
      state.statistics = {
        count: 0,
        score: 0
      },
      state.errorList = []
    },
    COUNT( state, payload ){
      state.statistics.count = state.statistics.count + 1
    },
    SCORE( state, payload ){
      state.statistics.score = state.statistics.score + 1
    },
    LOGERROR( state, payload ){
      state.errorList.push(payload)
    }
  },
  actions: {

  },
})
export default store